import React, { Component } from 'react'
import { withRouter } from 'react-router-dom'

// 接收一个组件作为参数，并且返回一个新的组件

// withRouter  给当前组件的props上添加路由信息

class about extends Component {
    push = () => {
        this.props.history.push("/login")
    }
    render() {
        console.log(this.props)
        // 路由信息  this.$route  和  this.$router
        return (
            <div>
                <h3>我是about页面</h3>
                <button onClick={ this.push }>点我跳转</button>
            </div>
        )
    }
}

about = withRouter(about)

export default about